<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    template="layout/template.xhtml">

<ui:define name="body">

    <rich:panel>
        <f:facet name="header">Reservation Details</f:facet>


        <s:decorate id="dateReservation" template="layout/display.xhtml">
            <ui:define name="label">Date reservation</ui:define>
            <h:outputText value="#{reservationHome.instance.dateReservation}">
                <s:convertDateTime type="both" dateStyle="short"/>
            </h:outputText>
        </s:decorate>

        <div style="clear:both"/>

    </rich:panel>

    <div class="actionButtons">

        <s:button view="/ReservationEdit.xhtml"
                    id="edit"
                 value="Edit"/>

        <s:button view="/#{empty reservationFrom ? 'ReservationList' : reservationFrom}.xhtml"
                    id="done"
                 value="Done"/>

    </div>

    <rich:tabPanel switchType="ajax">

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/manytoone.gif" style="vertical-align: middle; padding-right: 4px;"/>Client</h:panelGroup>
        </f:facet>
    <div class="association" id="clientParent">

        <h:outputText value="There is no client associated with this reservation."
                   rendered="#{reservationHome.instance.client == null}"/>

        <rich:dataTable var="_client"
                   value="#{reservationHome.instance.client}"
                rendered="#{reservationHome.instance.client != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="clientTable">
            <h:column>
                <f:facet name="header">Idclient</f:facet>
                <h:outputText value="#{_client.idclient}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Login</f:facet>
                <h:outputText value="#{_client.login}"/>
            </h:column>
            <h:column styleClass="action">
                <f:facet name="header">Action</f:facet>
                <s:link id="viewclient"
                     value="View"
                      view="/Client.xhtml">
                    <f:param name="clientIdclient"
                           value="#{_client.idclient}"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/manytoone.gif" style="vertical-align: middle; padding-right: 4px;"/>Voyage</h:panelGroup>
        </f:facet>
    <div class="association" id="voyageParent">

        <h:outputText value="There is no voyage associated with this reservation."
                   rendered="#{reservationHome.instance.voyage == null}"/>

        <rich:dataTable var="_voyage"
                   value="#{reservationHome.instance.voyage}"
                rendered="#{reservationHome.instance.voyage != null}"
              rowClasses="rvgRowOne,rvgRowTwo"
                      id="voyageTable">
            <h:column>
                <f:facet name="header">Id voyage</f:facet>
                <h:outputText value="#{_voyage.idVoyage}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Train idtrain</f:facet>
                <h:outputText value="#{_voyage.train.idtrain}"/>
            </h:column>
            <h:column>
                <f:facet name="header">Date depart</f:facet>
                <h:outputText value="#{_voyage.dateDepart}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column>
                <f:facet name="header">Date arrivee</f:facet>
                <h:outputText value="#{_voyage.dateArrivee}">
                    <s:convertDateTime type="both" dateStyle="short"/>
                </h:outputText>
            </h:column>
            <h:column styleClass="action">
                <f:facet name="header">Action</f:facet>
                <s:link id="viewvoyage"
                     value="View"
                      view="/Voyage.xhtml">
                    <f:param name="voyageIdVoyage"
                           value="#{_voyage.idVoyage}"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </div>
    </rich:tab>

    <rich:tab>
        <f:facet name="label">
            <h:panelGroup><h:graphicImage value="/img/onetomany.gif" style="vertical-align: middle; padding-right: 4px;"/>Tickets</h:panelGroup>
        </f:facet>
    <h:form styleClass="association" id="ticketsChildren">

        <h:outputText value="There are no tickets associated with this reservation."
                   rendered="#{empty reservationHome.tickets}"/>

        <rich:dataTable value="#{reservationHome.tickets}"
                       var="_ticket"
                  rendered="#{not empty reservationHome.tickets}"
                rowClasses="rvgRowOne,rvgRowTwo"
                        id="ticketsTable">
            <rich:column sortBy="#{_ticket.idticket}">
                <f:facet name="header">Idticket</f:facet>
                <h:outputText value="#{_ticket.idticket}"/>
            </rich:column>
            <h:column>
                <f:facet name="header">Action</f:facet>
                <s:link id="selectticket"
                     value="Select"
                      view="/Ticket.xhtml">
                    <f:param name="ticketIdticket"
                            value="#{_ticket.idticket}"/>
                    <f:param name="ticketFrom" value="Reservation"/>
                </s:link>
            </h:column>
        </rich:dataTable>

    </h:form>

    <div class="actionButtons">
        <s:button
               value="Add ticket"
                view="/TicketEdit.xhtml">
            <f:param name="reservationIdreservation"
                    value="#{reservationHome.instance.idreservation}"/>
            <f:param name="ticketFrom" value="Reservation"/>
        </s:button>
    </div>
    </rich:tab>
</rich:tabPanel>
</ui:define>

</ui:composition>
